
package innerclass;
public class Outter {
    // 成员变量
    private int age = 18;
    private String name = "zs";
    private static final int A = 20;
    // ---------------------
    // 成员内部类
    class Inner {
        private String msg = "hello Inner Class";
        private int age = 20;
        public void test() {
            System.out.println(msg);
            // 可以访问外部类的私有域
            System.out.println(Outter.this.age);
            // 自己的age
            System.out.println(this.age);
            System.out.println(A);
        }
    }
    // --------------------
    // 外部类成员方法
    public void fun() {
        int a = 0;
        // 外部类成员访问内部类要创建内部类对象
        Inner inner = new Inner();
        System.out.println(inner.msg);
    }
}
class Test {
    public static void main(String[] args) {
        Outter.Inner inner = new Outter().new Inner();
    }
}